from selenium.webdriver.common.by import By

byid = By.ID
byname = By.NAME
bycname = By.CLASS_NAME
bytname = By.TAG_NAME
bylink = By.LINK_TEXT
bycss = By.CSS_SELECTOR
byxpath = By.XPATH
byparriallike = By.PARTIAL_LINK_TEXT

url = "http://10.59.9.8:7007/boss/login"



# 登录界面元素配置信息
class LoginPageElements:
    # 用户名
    name_input = byname, 'loginName'
    # 密码
    pwd_input = byname, 'roncooPwd'
    # 登录按钮
    login_btn = byxpath, '//*[@id="form1"]/div[3]/input'
    # 验证码
    yzm_input = byxpath,'/html/body/div/div[2]/div[1]/form/c:if/div/ul/li[2]/input'
    # 断言
    dy_shouye = byxpath, '/html/body/div/div[1]/div/div/ul/li/a'
  # 断言
    dy_loginsess = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div/div/p[1]/span'
login_page = LoginPageElements()



# 用户管理
class UserManagePageElement():
    # 用户管理
    usermanage_loc = byxpath, '//*[@id="sidebar"]/div[2]/div[5]/h2/span'
    # 用户信息
    userinfo_loc = byxpath, '/html/body/div[1]/div[2]/div[2]/div[2]/div[6]/ul/li/div/a'
    # 添加用户
    adduser_loc = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div[2]/div[1]/ul/li[1]/a/span'
    # 用户名称
    username_input = bycss, '.tabsContent > div:nth-child(1) > fieldset:nth-child(1) > dl:nth-child(3) > dd:nth-child(2) > input:nth-child(1)'
    # 手机号
    phone_input = byname, 'mobile'
    # 登录密码
    login_pwd_input = byname, 'password'
    # 提交
    commit_loc = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[2]/ul/li[1]/div/div/button'
    # 取消
    cancel_loc = byxpath,'/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[2]/ul/li[2]/div/div/button'
    # 断言 回到用户编号
    dy_userid = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div[1]/form/div/table/tbody/tr/td[1]'
    # 查询第一条的用户名
    dy_username_one = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[3]/div'

    # 用户编号输入
    userid_input = byxpath, '//*[@id="navTab"]/div[2]/div[2]/div[1]/form/div/table/tbody/tr/td[1]/input'
    # 查询返回的条数
    dy_returncount = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div[2]/div[3]/div[1]/span[2]/a'
    # 查询按钮
    search_btn = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div[1]/form/div/table/tbody/tr/td[2]/div/div/button'
    # 查询暂无数据
    dy_nodata = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr/td/div'

user_page = UserManagePageElement()


# 支付管理
class PaymentPageElement():
    # 支付管理模块
    payment_loc = byxpath, '//*[@id="sidebar"]/div[2]/div[7]/h2'
    # 支付产品信息
    payinfo_loc = byxpath, '//*[@id="sidebar"]/div[2]/div[8]/ul/li[1]/div/a'
    # 添加支付产品
    addpay_loc = bycss, 'div.page:nth-child(3) > div:nth-child(3) > div:nth-child(1) > ul:nth-child(1) > li:nth-child(1) > a:nth-child(1) > span:nth-child(1)'
    # 支付产品编码
    productid_input = byname, 'productCode'
    # 支付产品名称
    proname_input = bycss, '.tabsContent > div:nth-child(1) > fieldset:nth-child(1) > dl:nth-child(3) > dd:nth-child(2) > input:nth-child(1)'
    # 设置支付方式
    cpayment_loc = byxpath, '//*[@id="navTab"]/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[6]/div/a[1]'
    # 添加支付方式
    addpayment_loc = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div[2]/div[1]/ul/li[1]/a/span'
   # 添加后第一个商品名称
    proname_loc = byxpath, '//*[@id="navTab"]/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[3]/div'
   # 支付费率
    pay_lv = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[4]/div/form/div[1]/div/fieldset/dl[3]/dd/input'
    # 上架
    shelves_loc = byxpath, '//*[@id="navTab"]/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[6]/div/a[2]'
    # 上架确认框
    shelves_right = byxpath, '//*[@id="alertMsgBox"]/div[1]/div/div[2]/ul/li[1]/a/span'
    # 断言下架
    dy_offshelves = byxpath, '//*[@id="navTab"]/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[6]/div/a[2]'
    # productid_是否存在
    dy_productid = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[2]/div'
    # 查询名称
    search_proname = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div[1]/form/div/table/tbody/tr/td[1]/input'
    # 查询btn
    searchbtn = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div[1]/form/div/table/tbody/tr/td[2]/div/div/button'
    # 查询断言
    dy_search = byxpath, '//*[@id="navTab"]/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[3]/div'
    # 用户支付配置
    user_pay_loc = byxpath, '/html/body/div[1]/div[2]/div[2]/div[2]/div[8]/ul/li[2]/div/a'
    # 添加支付配置
    add_pay_loc = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[4]/div[2]/div[1]/ul/li[1]/a/span'
    # 用户编号搜索icon
    userid_icon = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[1]/div/fieldset[1]/dl[1]/dd/a'
    # 选择第一个
    select_one = byxpath, '/html/body/div[13]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[7]/div/a'
    # 支付产品编号icon
    proid_icon = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[1]/div/fieldset[1]/dl[3]/dd/a'
    # 支付产品第一个
    select_pro = byxpath, '/html/body/div[13]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[5]/div/a'
    # 风险预期
    fengxian_input = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[1]/div/fieldset[1]/dl[6]/dd/input'
    # 提交

    commit_loc = bycss, '.formBar > ul:nth-child(1) > li:nth-child(1) > div:nth-child(1) > div:nth-child(1) > button:nth-child(1)'
    # 取消
    cancel_loc = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[2]/ul/li[2]/div/div/button'
    # 断言proname
    proname1 = byxpath, '/html/body/div[13]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[3]/div'
    # 断言添加后的proname
    proname2 = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[3]/div'
#     查询用户名
    sear_name_input = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div[1]/form/div/table/tbody/tr/td[1]/input'
#     支付产品名称
    proname1_input = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div[1]/form/div/table/tbody/tr/td[2]/input'
    # 查询按钮
    search_btn = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div[1]/form/div/table/tbody/tr/td[3]/div'
    # 断言查询的count
    count = byxpath, '//*[@id="navTab"]/div[2]/div[3]/div[2]/div[3]/div[1]/span[2]/a'
    # 业务中下面的条数-用户支付配置
    dy_payconfigcount = byxpath,'/html/body/div[1]/div[3]/div/div[2]/div[4]/div[2]/div[3]/div[1]/span[2]/a'
pay_el = PaymentPageElement()